# +--------------------------
# | User: zq                -
# | Version: python3.7      -
# | Time: 2020-03-16 10:25                
# +--------------------------
from peewee import *

# db = MySQLDatabase("spider_csdn", host="47.111.17.68", port=3306, user="spider_csdn", password="wuhu@888")
db = MySQLDatabase("spider", host="localhost", port=3306, user="root", password="root")


class BaseModel(Model):
    class Meta:
        database = db


# 列表-文章信息
class List(BaseModel):
    list_id = IntegerField(verbose_name="帖子id")
    title = CharField(verbose_name="标题")
    author = CharField(verbose_name="作者")
    create_time = DateField(verbose_name="发帖时间")
    huifu_num = IntegerField(default=0, verbose_name="回复数量")
    click_num = IntegerField(default=0, verbose_name="点击浏览数量")
    last_submit = DateTimeField(verbose_name="最后回复时间")
    last_submit_author = CharField(verbose_name="最后回复人昵称")
    content = TextField(default='', verbose_name="帖子内容")


if __name__ == "__main__":
    db.create_tables([List])
